package  lab03.test04;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Test04{
    public static void main(String[] args) {
        String source="F:\\新建文本文档.txt";
        String target="F:\\新建文本文档1.txt";
        FileInputStream fileInputStream=null;
        FileOutputStream fileOutputStream=null;
        try {
            fileInputStream=new FileInputStream(source);
            fileOutputStream=new FileOutputStream(target);
            int data;
            while((data=fileInputStream.read())!=-1){
                fileOutputStream.write(data);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally {
            try {
                fileInputStream.close();
                fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }

        }

    }
}
